<?php

require_once(APPPATH . '/controllers/test/Toast.php');

error_reporting(1);

class Credit_tests extends Toast {
	 
	var $CI;

	function Credit_tests() {
		parent::Toast(__FILE__);
		$this->load->model('Credit_model','',TRUE);
		$this->load->helper('common_functions');

		// Load any models, libraries etc. you need here
	}

	function _pre() {

		 
	}
	function _post(){
		 
	}
	function test_add() {
	
		$result = "";
		$id = $this->Credit_model->add(1,30);
		$result = $result . "Add new Point in ID : " . $id;
		$this->message = $result;
		$this->_assert_equals($id, 1);
	}
	
	function test_increase() {

		$result = "";
		$id = $this->Credit_model->increase(1,40);
		$result = $result . "Increased Point in ID : " . $id;
		$this->message = $result;
		$this->_assert_equals($id, 1);
	}

	function test_decrease(){
		$result = "";
		$id = $this->Credit_model->decrease(1,10);
		$result = $result. "Decreased Point in ID :" . $id;
		$this->message = $result;
		$this->_assert_equals($id, 1);
	}
	
	function test_setzero(){
		$result = "";
		$id = $this->Credit_model->setzero(1);
		$result = $result . "Set credit to zero in ID: " . $id;
		$this->message = $result;
		$this->_assert_equals($id, 1);
		
	}
	function test_checkpoint(){
		$result = "";
		$query = $this->Credit_model->check_membercredit(1,1);
		$result = $result. "The result is " . $this->Credit_model->get_points(1);
		$this->message = $result;
		$this->_assert_equals($query, 'true');
	}
	

	 

}
?>
